﻿
using System;
using System.Collections.Generic;
using PsqlDotnet.Enums;
namespace PsqlDotnet.Model.Schema
{
    public class PrimaryKey : IConstraint
    {
        public PrimaryKey(string name, IEnumerable<string> sourceColumns, string sourceTable)
        {
            if (String.IsNullOrWhiteSpace(name) ||
                sourceColumns == null ||
                String.IsNullOrWhiteSpace(sourceTable))
            {
                throw new ArgumentException("Illegal null or empty args");
            }

            Name = name;
            SourceColumns = sourceColumns;
            SourceTable = sourceTable;
        }

        #region IRelation Members

        public ConstraintType RelationType
        {
            get
            {
                return ConstraintType.PrimaryKey;
            }
        }

        public string Name { get; private set; }

        public string SourceTable { get; private set; }

        #endregion

        public IEnumerable<string> SourceColumns { get; set; }
    }
}
